

//上滑下滑缩小 需要jq
define(['progress.min'], function() {
  function fixPagesHeight() {
    $('.swiper-slide,.swiper-container').css({
      height: $(window).height(),
    })
  }
  $(window).on('resize', function() {
    fixPagesHeight()
  });
  fixPagesHeight();
  var mySwiper = new Swiper('.swiper-container', {
    mode: 'vertical',
    progress: true,
    loop: false,
    onProgressChange: function(swiper) {
      for (var i = 0; i < swiper.slides.length; i++) {
        var slide = swiper.slides[i];
        var progress = slide.progress;
        var translate, boxShadow;
        translate = progress * swiper.height * 0.8;
        scale = 1 - Math.min(Math.abs(progress * 0.2), 1);
        boxShadowOpacity = 0;
        slide.style.boxShadow = '0px 0px 10px rgba(0,0,0,' + boxShadowOpacity + ')';
        if (slide.isActive()) {
          swiper.setTransform(slide, 'translate3d(0,' + (translate) + 'px,0) scale(' + scale + ')');
        }
      }
    },
    onFirstInit: function(swiper) {
      for (var i = 0; i < swiper.slides.length; i++) {
        var slide = swiper.slides[i];
        var anis = slide.querySelectorAll('.ani');
        for (var j = 0; j < anis.length; j++) {
          swiper.setTransform(anis[j], anis[j].getAttribute('transf'));
        }
      }
    },
    onSlideChangeEnd: function(swiper) {
      for (var i = 0; i < swiper.slides.length; i++) {
        swiper.setTransform(swiper.slides[i], '', 0);
        swiper.setTransition(swiper.slides[i], 0);
        swiper.slides[i].style.zIndex = Math.abs(swiper.slides[i].progress);
      }
      var anis = swiper.activeSlide().querySelectorAll('.ani');
      for (var j = 0; j < anis.length; j++) {
        swiper.setTransform(anis[j], 'translateX(0px)');
        swiper.setTransition(anis[j], anis[j].getAttribute('transt'));
      }
      window.initAni($(swiper.visibleSlides), swiper.activeLoopIndex);
      window.clearAni($(swiper.wrapper).children().eq(swiper.previousIndex));
    },
    onSetWrapperTransition: function(swiper, speed) {
      swiper.setTransition(swiper.activeSlide(), speed);
    }
  });
});
